<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>配送点订单管理</title>
<!-- 引入easyui 的主题样式  和  easyui 提供的图标样式 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/icon.css" />
<!-- 引入jquery 和  easyui.js   中文设置js-->
<script type="text/javascript"
	src="${pageContext.request.contextPath}\js\jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">

$(function(){

	$('#dg').datagrid({    
	    url:'getorder',    
	    columns:[[
	        {field : 'ck',width : 100,checkbox : true},     
	        {field:'orId',title:'订单编号',width:100,align:'center'},    
	        {field:'orDeliveryDate',title:'收货日期',width:100,align:'center'},    
	        {field:'otName',title:'订单类别',width:100,align:'center'},   
	        {field:'orState',title:'订单状态',width:100,align:'center'},   
	        {field:'orRemarks',title:'备注',width:100},  
	        {field:'orSenderName',title:'寄件人姓名',width:100},  
	        {field:'orSenderPhone',title:'寄件人电话',width:100},  
	        {field:'orSenderCompanyPhone',title:'寄件人单位电话',width:100},  
	        {field:'orSenderAddr',title:'寄件人地址',width:100},  
	        {field:'orRecipientName',title:'收件人姓名',width:100},  
	        {field:'orRecipientPhone',title:'收件人电话',width:100},  
	        {field:'orRecipientCompanyPhone',title:'收件人单位电话',width:100},  
	        {field:'orRecipientAddr',title:'收件人地址',width:100},  
	        {field:'orCargoWeight',title:'货物重量',width:100},  
	        {field:'orCargoVolume',title:'货物体积',width:100},  
	        {field:'orItemName',title:'物品名称',width:100},  
	        {field:'orItemNumber',title:'物品数量',width:100},  
	        {field:'cyName',title:'货物类别',width:100},  
	        {field:'orInsuredValue',title:'保价金额',width:100},  
	        {field:'orPostage',title:'资费',width:100},  
	        {field:'orTotalCost',title:'总计费用',width:100},  
	        {field:'orPaymentMethod',title:'支付方式',width:100},  
	        {field:'orIssuanceDate',title:'发货日',width:100},   
	        {field:'dpNamef',title:'发货地',width:100},  
	        {field:'dpNames',title:'收货地',width:100},  
	        {field:'csCurrentLocation',title:'订单当前地',width:100},  
	        {field:'customerName',title:'客户姓名',width:100},  
	        {field:'eiName',title:'配送点员工',width:100},   
	    ]]  ,
	rownumbers : true,
	pagePosition : 'bottom',
	pagination : true,
	pageSize : 10,
	pageList : [ 5, 10, 15 ],
	toolbar: [{
		iconCls: 'icon-edit',
		text:"确认已签收",
		handler: function(){
			var or = $("#dg").datagrid("getSelections");
			if (or.length>0) {
				$('#updateor').window("open");
				var orIds=[];    
			    for (var i = 0; i < or.length; i++) {    
			        var orId1=or[i].orId; //取出id值  
			        orIds.push(orId1); //将id值放入数组中  
			    }
			  
			    $('#orId1').textbox({
					value : orIds,
				});
				$("#orId1").next().hide();
			}else{
				$.messager.alert('警告','请选择需要确认的订单！');  
			}
		}
	}]
	});
	
	
	//修改窗口
	$('#updateor').window({
		width : 300,
		height : 200,
		modal : true,
		title : "确认",
		collapsible : false,
		minimizable : false,
		maximizable : false,
		closable : false,
		closed : true
	});

	$('#orState').textbox({
		value:"已签收",
	});
	$("#orState").next().hide();
	//修改确定按钮
	$('#updateoryes').linkbutton({
		onClick : function() {
			$('#updateor').window("close");
			$.ajax({
				url : 'updateOR',
				type : 'post',
				data : {
					'orIds':$("#orId1").val(),
					'orState' : $("#orState").val(),
				},
				dataType : 'text',
				success : function(data) {
					alert(data)
					if (data == 1) {
						$("#dg").datagrid('reload');
						$.messager.alert('消息','修改成功');  
					} else {
						$.messager.show({
							title : '信息提示',
							msg : '修改失败',
							timeout : 1000,
							showType : 'slide'
						});
					}

				}
			});
		}
	});
	//修改取消
	$('#updateorno').linkbutton({
		onClick : function() {
			$('#updateor').window("close");
			$("#dg").datagrid('uncheckAll')
		}
	});
	
	
	
});

</script>
<body>
<table id="dg"></table>

<!-- 修改窗口 -->

	<div id="updateor">
		
<div style="margin-left: 30px; margin-top: 30px">
	<input id="orId1" type="text"
				style="width: 200px; height: 32px">
			 <input
				id="orState" type="text"
				style="width: 200px; height: 32px"> 
				
				<br><br>
				 <a id="updateoryes" href="#" iconCls="icon-ok"
				style="width: 90px; height: 32px">确定</a> &nbsp;&nbsp;&nbsp;&nbsp;
				<a id="updateorno" href="#"
				iconCls="icon-no" style="width: 90px; height: 32px">取消</a>

		</div>
		</div>
</body>
</html>